package com.liugl.recyclerviewtest

import android.app.Activity

object ActivityController {
    private val activities = ArrayList<Activity>()

    fun addActivity(activity: Activity) {
        activities.add(activity)
    }

    fun removeActivity(activity: Activity) {
        activities.remove(activity)
    }

    fun finishAll() {
        for (a in activities) {
            if (!a.isFinishing) a.finish()
        }
        
        activities.clear()
    }
}